// OUTDOOR SECTION SCRIPT
//    Section: X = 1, Y = 2

// This is the special encounter script for this town.
// The states INIT_STATE and START_STATE have
// meanings that are described in the documenation. States you write
// yourself should be numbered from 10-100.

beginoutdoorscript;

variables;

short i,j,k,r1,choice;

body;

beginstate INIT_STATE;
// This state called whenever this section is loaded into memory.
break;

beginstate START_STATE;
// This state is called every turn the party is in this outdoor section. 
break;

beginstate 10;
	if (get_flag(212,1) == 250)
		end();
	set_flag(212,1,250);
	message_dialog("You are spotted by some bandit watchouts.","");
	create_out_spec_enc(0);
break;

beginstate 11;
	if (get_flag(212,2) >= 1)
		set_state_continue(16);
	set_state_continue(12);
break;

beginstate 12;
	reset_dialog();
	add_dialog_str(0,"You come upon a well-guarded bandit encampment. Evidently, this area is outside the jurisdiction of any of the major clans on the island. Consequentially, these bandits have free rein here.",0);
	add_dialog_str(1,"The encampment is rather large, and there are many of them, making it a difficult target. However, the prospects for treasure are quite good.",0);
	add_dialog_choice(0,"OK.");
	add_dialog_choice(1,"Attack.");
	choice = run_dialog(1);
	if (choice == 1)	
		block_entry(1);	
	if (choice == 2){
	create_out_spec_enc(1);
	set_state_continue(23);
	}
break;

beginstate 15;
	set_flag(212,2,1);
break;

beginstate 16;
	if (get_flag(212,2) >= 2)
		set_state_continue(17);
	set_state_continue(18);
break;

beginstate 17;
	message_dialog("There's nothing else of value here.","");
	block_entry(1);
break;

beginstate 18;
	set_flag(212,2,2);
	set_state_continue(19);
break;

beginstate 19;
	reset_dialog();
	add_dialog_str(0,"The brigands defeated or scattered, you conduct a thorough search of their houses, plundering as you go. You come out quite a bit richer than before.",0);
	add_dialog_choice(0,"OK.");
	choice = run_dialog(1);
	change_coins(500);
break;

beginstate 21;
	if (get_flag(212,3) == 250)
		end();
	reset_dialog();
	add_dialog_str(0,"Some traveling merchants are currently passing over the bridge. Seeing you, they offer to sell you some of their wares at a discount.",0);
	add_dialog_choice(0,"OK.");
	add_dialog_choice(1,"Buy.");
	choice = run_dialog(1);
	if (choice == 2){
	set_flag(212,3,250);
	begin_shop_mode("Merchant Caravan","Some traveling merchants are currently passing over the bridge. Seeing you, they offer to sell you some of their wares at a discount. ",7,1,-1);
	}
break;

beginstate 23;
	block_entry(1);
break;

beginstate 24;
	reset_dialog();
	add_dialog_str(0,"A small hut stands here, a thin wisp of smoke escaping from the roof. A young man sits on the doorstep, mixing a potion. When you approach, he stands up to greet you.",0);
	add_dialog_str(1,"In a brisk manner, he introduces himself as Burton, _master of herbalism_. After a brief tea, he offers to sell you some recipes.",0);
	add_dialog_choice(0,"OK.");
	add_dialog_choice(1,"Buy.");
	choice = run_dialog(1);
	if (choice == 2)
	begin_shop_mode("Burton's Formulas"," A young man introduces himself as Burton, _master of herbalism_. After a brief tea, he offers to sell you some recipes.",8,3,-1);
break;

